package com.leyou.item.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.leyou.item.entity.Category;
import com.leyou.item.entity.CategoryNames;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author ShenMin
 * @date 2021/7/14 17:26
 * @description
 */
@Component
public interface CategoryMapper extends BaseMapper<Category> {
    //@Select("select category_id from tb_category_brand where brand_id = #{id}")
    List<Category> listCategoryByBid(Long id);

    @Select("SELECT tc1.name tcName1,tc2.name tcName2,tc3.name tcName3 FROM tb_category tc1, tb_category tc2, tb_category tc3 WHERE tc1.id = #{cid1} AND tc2.id = #{cid2} AND tc3.id = #{cid3}")
    CategoryNames listCategoryNamesById(@Param("cid1") Long cid1,@Param("cid2") Long cid2,@Param("cid3") Long cid3);
}
